package org.neptune.web.controller;

import org.neptune.api.request.SeckillRequest;
import org.neptune.api.response.SeckillResponse;
import org.neptune.common.response.ResponseBean;
import org.neptune.service.service.SeckillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/seckill")
public class SeckillController {

	@Autowired
	private SeckillService seckillService;

	@RequestMapping(value = "/seckillByAopLimit", method = RequestMethod.POST)
	public ResponseBean<SeckillResponse> seckillByAopLimit(SeckillRequest seckillRequest) {
		ResponseBean<SeckillResponse> responseBean = new ResponseBean<SeckillResponse>();
		responseBean.setResult(seckillService.seckillByAopLimit(seckillRequest));
		return responseBean;
	}

	@RequestMapping(value = "/seckillByCache", method = RequestMethod.POST)
	public ResponseBean<SeckillResponse> seckillByCache(SeckillRequest seckillRequest) {
		ResponseBean<SeckillResponse> responseBean = new ResponseBean<SeckillResponse>();
		responseBean.setResult(seckillService.seckillByCache(seckillRequest));
		return responseBean;
	}

}
